
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="js/test.js" %>
<%@ include file="js/InfoHandler.js" %>
<%@ include file="js/Ajax.js" %>
<%@ include file="js/Post.js" %>


<%
    String parentPath = request.getParameter("parentPath");
//TODO DELETE ASOO is not working properly after 1st delete
//TODO add resourcePath for Asso
    %>

<script type="text/javascript">
    var jsParentPath = "<%=parentPath%>";
    showHideCommon('diaAddAsso');
    showHideCommon('diaTagAddTable');
    showHideCommon('otherData');
    //TODO validate sPath
</script>

<br/>
<input type="hidden" id="sPath" name="sPath" value=""/>
<form id="diaAddForm" action="../registry/custom/dia/dia_add_handler_ajaxprocessor.jsp" onsubmit="Post.Send(this); showHideCommon('otherData'); return false;" method="post">
    <input type="hidden" name="parentPath" value="<%=parentPath%>"/>
    <table style="width:100%" class="styledLeft">
            <thead>
                    <tr>
                            <th colspan="2">
    <strong>Add a new External Documentation</strong>
    </th>
                    </tr>
            </thead>
            <tbody>
        <tr>
            <td class="leftCol-med">Document Name <span class="required">*</span></td>
            <td><input type="text" id="documentName" name="documentName"/></td>
        </tr>
         <tr>
            <td>Title</td>
            <td><input type="text" name="diaTitle"/></td>
        </tr>
        <tr>
            <td>Summary</td>
            <td><textarea name="diaSummary" rows="4" cols="20"></textarea></td>
        </tr>
        <tr>
            <td>External Link <span class="required">*</span></td>
            <td><input type="text" name="diaLink"/></td>
        </tr>

        <tr>
            <%--<td><input type="button" value="Save" onclick="submitCustomAddUIForm('diaAddForm', '../registry/custom/topics/dia_add_handler_ajaxprocessor.jsp')"/></td>--%>
            <td colspan="2" class="buttonRow"><input class="button" type="submit" value="Create"/></td>
        </tr>
            </tbody>
    </table>
</form>

  <div id="otherData">
    
    <table style="width:100%" class="styledLeft">
                    <thead>
                    <tr>
                            <th colspan="2">
    <strong>Add Further Details</strong>
    </th>
                    </tr>
            </thead>
            <tbody>
            <tr>
            <td class="leftCol-med">
                Related Documentations
            </td>
            <td>
               <div class="icon-link-ouside registryWriteOperation" class="box1-mid" >
                    <a class="icon-link registryWriteOperation" style="background-image:url(../admin/images/add.gif);" onclick="javascript:showHideCommon('diaAddAsso');expandIfNot('diaAssociations');if($('diaAddAsso').style.display!='none')document.forms.aaa.type.focus()">
                        Add Related Documentation
                    </a>
               </div>
                <div id="diaAddAsso">
                    <form name="aaa" action="../registry/custom/dia/dia_addX_ajaxprocessor.jsp" onsubmit="api.addAssociationTest('aaa'); return false;">
                        <table>
                        <tr>
                            <td valign="top">Type <span class="required">*</span></td>
                            <td>
                                <input type="text" id="aType" value="testType" style="width:130px;margin-bottom:5px;"/><br>
                            </td>
                        </tr>
                        <tr>
                            <td>Path <span class="required">*</span></td>
                            <td>
                                <input type="text" id="aPath" value="http://a" />
                                <input type="button" class="button" value=".." title="Resource Tree" onclick="showResourceTree('aPath');">
                            </td>
                        </tr>
                        </table>
                        <input type="submit" value="Add">
                        <input type="reset" value="Cancel">
                        <div id="diaAssoDiv"> </div>
                    </form>
                </div>
        </td>
        </tr>

                <tr>
           <td>Tags</td>
          <!--  <td><i nput type="te xt" name="diaTags" id="diaTags"/></td> -->
      <td>
          <div style="height: auto;" id="diaAddTags" class="info-area"> <!-- class="box1-mid">-->

            <div id="diaTagAddDiv" class="icon-link-ouside registryWriteOperation" >
                <a onclick="javascript:showHideCommon('diaTagAddTable');if($('diaTagAddTable').style.display!='none')$('diaTags').focus();" style="background-image: url(../admin/images/add.gif);" class="icon-link registryWriteOperation">
                    Add New Tag
                </a>
            </div>
            <div  id="diaTagAddTable" class="registryWriteOperation" style="margin-top: 10px; ">
                <form name="diaTagForm" action="../registry/custom/dia/dia_addX_ajaxprocessor.jsp" onsubmit="api.applyTag(event); return false;">
                    <table border="0px">
                        <tr><td>
                            <input type="text" name="diaTags" id="diaTags">
                        </td></tr>
                        <tr> <td>
                                <input type="submit" name="addTagsButton" value="Add Tags" onclick="api.applyTag(event);">
                            <input type="button" name="cancelTagsButton" value="Cancel" onclick="showHideCommon('diaTagAddTable');">
             <!--add further functns to cancel-->
                            <br>
                            <div style="font-style: italic; margin-top: 5px;">
                                <img alt=" " style="margin-right: 5px;" src="../info/images/help-small.jpg">
                                Use commas ("one, two") to add multiple tags.
                            </div>
                        </td></tr>
                    </table>
                  <div id="diaTagDiv"> </div>
                </form>
            </div>
      </div>
      </td>
        </tr>

        <tr>
            <%--<td><input type="button" value="Save" onclick="submitCustomAddUIForm('diaAddForm', '../registry/custom/topics/dia_add_handler_ajaxprocessor.jsp')"/></td>--%>
            <td colspan="2" class="buttonRow"><input class="button" type="button" value="Done" onclick="window.location.href='https://localhost:9443/carbon/resources/resource.jsp?path='+document.getElementsByName('sPath')[0].value"/></td>
        </tr>


    </table>
    </form>
  </div>
           

<form id="diaAddForm2" action="../registry/custom/dia/dia_add_ajaxprocessor.jsp"  method="post">
    <input type="hidden" id="sPath1" name="sPath1" value="<%=parentPath%>"/>
    <table style="width:100%" class="styledLeft">
        <tr><td>
                
            </td></tr>
    <!--
        <tr>
        <td>Related Documents</td>
        <td>
   
    <div class="box1-mid" id="diaAssociationsExpanded" style="height: auto; ">

        <div class="icon-link-ouside registryWriteOperation">
            <a class="icon-link registryWriteOperation" style="background-image:url(../admin/images/add.gif);" onclick="javascript:showHideCommon('diaAssociationsAddDiv');expandIfNot('diaAssociations');if($('diaAssociationsAddDiv').style.display!='none')document.forms.diaAssoForm.type.focus()">
                Add Association
            </a>
        </div>

        <div id="diaAssociationsSum"></div>
        <div class="registryWriteOperation" id="diaAssociationsAddDiv" style="">
            <form onsubmit="return api.addAssociation('diaAssoForm');" name="diaAssoForm">
                <input type="hidden" name="resourcePath" id="diaResourcePath" value="< %=sPath%>">
                <table cellpadding="0" cellspacing="0" border="0" class="styledLeft">
                    <thead>
                        <tr>
                            <th colspan="2">Add New Association</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td valign="top">Type <span class="required">*</span></td>
                            <td><input type="text" name="diaType" id="diaType" style="width:130px;margin-bottom:5px;">
                            </td>
                        </tr>
                        <tr>
                            <td valign="top">Path <span class="required">*</span></td>
                            <td><input type="text" id="diaAssociationPaths" name="diaAssociationPaths">
                                <input type="button" class="button" value=".." title="Resource Tree" onclick="showResourceTree('associationPaths');">
                            </td>
                        </tr>
                        <tr>

                            <td colspan="2" class="buttonRow"><input type="button" class="button" value="Add" onclick="api.addAssociation('diaAssoForm');"> <input style="margin-left:5px;" type="button" class="button" value="Cancel" onclick="showHideCommon('diaAssociationsAddDiv');">
                            </td>
                        </tr>
                    </tbody>
                </table>

            </form>
        </div>

        <div id="diaAssociationsDiv">
            <script type="text/javascript" src="../yui/build/utilities/utilities.js"></script>
            <script type="text/javascript" src="../yui/build/yahoo/yahoo-min.js"></script>
            <script type="text/javascript" src="../yui/build/json/json-min.js"></script>
            <script type="text/javascript">
                var org_wso2_carbon_registry_common_ui_tmpPairs = '{"dialog.cancel":"Cancel","dialog.ok":"OK","wrong.email":"Please enter a valid email address.","not.valid.url":"is not a valid URL.","no.email":"You didn\'t enter an email address.","illegal.username":"The username contains illegal characters.","the":"The","wrong.username":"The length of the username is wrong. It should be 5 to 15 characters long.","input.contains.illegal.chars":"contains illegal characters.","wrong.password":"The length of the password is wrong. It should be 3 to 15 characters long.","no.username":"You didn\'t enter a username.","not.filled":"has not been filled in.","contains.illegal.chars":"contains one or more illegal characters (~!@#$;%^*+={}|\<>).","no.password":"You didn\'t enter a password.","illegal.password":"The password contains illegal characters.","the.required.field":"The required field","illegal.email":"The email address contains illegal characters.","invalid.date":"is not a valid date. Please make sure it is in MM/DD/YYYY format."}'; 
                var org_wso2_carbon_registry_common_ui_jsi18n = YAHOO.lang.JSON.parse(org_wso2_carbon_registry_common_ui_tmpPairs);
            </script>

            <script type="text/javascript" src="../registry_common/js/registry_validation.js"></script>
            <script type="text/javascript" src="../registry_common/js/registry_common.js"></script>
            <script type="text/javascript" src="../ajax/js/prototype.js"></script>


            <script type="text/javascript" src="../yui/build/utilities/utilities.js"></script>
            <script type="text/javascript" src="../yui/build/yahoo/yahoo-min.js"></script>
            <script type="text/javascript" src="../yui/build/json/json-min.js"></script>
            <script type="text/javascript">
                var org_wso2_carbon_registry_relations_ui_tmpPairs = '{"dialog.cancel":"Cancel","dialog.ok":"OK","path.cannot.contain.only.white.spaces":"Path cannot contain only white spaces","you.cant.have.duplicate":"You can\'t have duplication","are.you.sure.you.want.to.delete":"Are you sure you want to delete","dependency.tree":"Dependency Tree","association":"assocation","session.timed.out":"Session timed out. Please login again","association.tree.loading":"Association tree loading please wait ..","dependency.tree.loading":"Dependency tree loading please wait ..","type":"Type","association.type.cannot.contain.only.white.spaces":"Association type cannot contain only white spaces","no.dependencies":"No dependencies for given resource.","dependency":"dependency","the.given":"The given","already.exists":"already exists.","permanently":"permanently?","dependencies":"dependencies.","associations":"assocations.","path":"Path","no.associations":"No associations for given resource.","resource.does.not.exist":"A resource does not exist at the given path:","association.tree":"Association Tree"}';
                var org_wso2_carbon_registry_relations_ui_jsi18n = YAHOO.lang.JSON.parse(org_wso2_carbon_registry_relations_ui_tmpPairs);
            </script>
            
            <script type="text/javascript" src="../relations/js/relations.js"></script>

            <div id="diaAssociationsSum" class="summeryStyle">

                No associations on this entry yet.

            </div>
            <div id="diaAssociationsList">

            </div>

        </div>
    </div>

            </td>
        </tr>
        -->
         <!--

        <tr>
           <td>Tags</td>
          <!--  <td><i nput type="te xt" name="diaTags" id="diaTags"/></td>      -- >
      <td>
      <div style="height: auto;" id="tagsExpandedx" class="box1-mid">

            <div id="diaTagAddDiv" class="icon-link-ouside registryWriteOperation">
                <a onclick="javascript:showHideCommon('diaTagAddTable');if($('diaTagAddTable').style.display!='none')$('diaTags').focus();" style="background-image: url(../admin/images/add.gif);" class="icon-link registryWriteOperation">
                    Add New Tag
                </a>
            </div>
            <div style="margin-top: 10px;" id="diaTagAddTable" class="registryWriteOperation">
                <input type="text" name="diaTags" id="diaTags">
                <br><br>
                <div style="font-style: italic; margin-top: 5px;">
                    <img alt=" " style="margin-right: 5px;" src="../info/images/help-small.jpg">
                    Use commas ("one, two") to add multiple tags.
                </div>
            </div>
      </div>
      </td>
        </tr>

        <tr>
            <%--<td><input type="button" value="Save" onclick="submitCustomAddUIForm('diaAddForm', '../registry/custom/topics/dia_add_handler_ajaxprocessor.jsp')"/></td>--%>
            <td colspan="2" class="buttonRow"><input class="button" type="submit" value="Done"/></td>
        </tr>
-->
    </table>
        

    </form> 
<br/>
